import Vue from 'vue'
import VueRouter from 'vue-router'
import IndexView from '../views/IndexView.vue'

Vue.use(VueRouter);

const routes = [
  {
    path: '/signal',
    name: 'Signaldetail',
    component: () => import('../views/cycloPedia/SignalDetail.vue'),
  },
  {
    path: '/diseases',
    name: 'Diseases',
    component: () => import('../views/cycloPedia/DiseasesView.vue'),
  },
  {
    path: '/quickregistration',
    name: 'quickregistration',
    props:true,
    component: () => import('../views/cycloPedia/QuickRegistration.vue'),
  },
  {
    path: '/articledetail',
    name: 'articledetail',
    component: () => import('../views/cycloPedia/DetailView.vue'),
  },
  {
    path: '/',
    redirect: '/index/home',
  },
  {
    path: '/index',
    name: 'index',
    redirect: '/index/home',
    component: IndexView,
    children: [
      {
        path: 'home',
        name: 'home',
        component: () => import('../views/homePage/HomeView.vue'),
        meta: { keepAlive: true },
      },
      {
        path: 'cyclo',
        name: 'cyclo',
        component: () => import('../views/cycloPedia/CycloView.vue'),
        meta: { keepAlive: true },
      },
      {
        path: 'hos',
        name: 'hos',
        component: () => import('../views/hosPital/HosView.vue'),
        meta: { keepAlive: true },
      },
      {
        path: 'my',
        name: 'my',
        component: () => import('../views/my/MyView.vue'),
        meta: { keepAlive: true },
      },
    ]
  },
  {
    path: '/section',
    name: 'section',
    component: () => import('../views/homePage/Section.vue'),
  },
  {
    path: '/selectClass',
    name: 'selectClass',
    component: () => import('../views/homePage/SelectClass.vue'),
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import('../views/hosPital/Detail.vue')
  }, {
    path: '/doctorDetail',
    name: 'doctorDetail',
    component: () => import('../views/hosPital/DoctorDetail.vue')
  },
  {
    path: '/video',
    name: 'video',
    component: () => import('../views/homePage/VideoView.vue'),
  },
  {
    path: '/call/:id?',
    name: 'call',
    props: true,
    component: () => import('../views/homePage/CallView.vue'),
  },
  {
    path: '/health',
    name: 'health',
    component: () => import('../views/homePage/HealthView.vue'),
    meta: { keepAlive: true },
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/my/register'),
  },
  {
    path: '/aboutmine',
    name: 'Aboutmine',
    component: () => import('../views/my/aboutMine'),
  },
  {
    path: '/message',
    name: 'Message',
    component: () => import('../views/my/message'),
  },
  {
    path: '/privacy',
    name: 'Privacy',
    component: () => import('../views/my/privacy'),
  },
  {
    path: '/userletter',
    name: 'userLetter',
    component: () => import('../views/my/userLetter'),
  },
  {
    path: '/infoset',
    name: 'InfoSet',
    component: () => import('../views/my/InfoSet'),
  },
  {
    path: '/patient',
    name: 'patient',
    component: () => import('../views/my/patient'),
  },
  {
    path: '/select',
    name: 'select',
    component: () => import('../views/homePage/SelectView.vue'),
  },
  {
    path: '/collect',
    name: 'Collect',
    component: () => import('../views/my/collect'),
  },
  {
    path: '/minegh',
    name: 'mineGH',
    component: () => import('../views/my/mineGH'),
  },
  {
    path: '/yuyuedetail',
    name: 'yuyueDetail',
    component: () => import('../views/my/yuyueDetail'),
  },
  {
    path: '/patientadd',
    name: 'patientAdd',
    component: () => import('../views/my/patientAdd'),
  },
  {
    path: '/hospital',
    component: () => import('../views/homePage/Allks.vue'),
  },
  {
    path: '/soket',
    name: 'soket',
    component: () => import('../views/my/soket.vue'),
  },
]

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

router.beforeEach((to,from,next)=>{
  document.title = '京医通'
  next()
})
export default router;
